home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / demo / wit472.zip / LIB / HELP / MORPHO / BERODE / BERODE.bin
Text File  |  1994-11-25  |  4KB  |  91 lines

  1. OPERATOR
  2.  
  3. berode --- binary erosion
  4.  
  5.  
  6. DESCRIPTION
  7.  
  8. The berode operator performs a morphological erosion on the input image. 
  9. Contiguous white areas in the image are considered objects and the background 
  10. is assumed to be black. Erosion separates objects that are touching and 
  11. removes isolated pixels. The kernel parameter allows the user to specify a 
  12. structuring element which will control the erosion. The center of the kernel 
  13. is always in row ( kernelHeight / 2) and column ( kernelWidth / 2). The 
  14. operation of erosion is such that for every pixel p in the input image, if 
  15. every pixel in the neighbourhood of p , as defined by the kernel dimensions, 
  16. is on and the corresponding entry in the kernel is also on, then the output 
  17. pixel corresponding to p will be set. Otherwise, it will be cleared. In other 
  18. words, the kernel defines a mask which is layed over the input image with 
  19. its center aligned on a pixel at row r and column c . The output pixel at r 
  20. and c will be set if every combination input pixel is set and its 
  21. corresponding bit in the kernel mask is also set. For example, 
  22.  
  23.  
  24.  
  25.    1)  Input: 0 0 0 0 0          Kernel: 0 1 1     Output: 0 0 0 0 0
  26.               0 1 1 0 0                                    0 1 0 0 0
  27.               0 1 1 1 0                                    0 1 1 0 0
  28.               0 0 1 1 0                                    0 0 1 0 0
  29.               0 0 0 0 0                                    0 0 0 0 0
  30.  
  31.  
  32.  
  33.    2)                            Kernel: 1 1 0     Output: 0 0 0 0 0
  34.                                                            0 0 1 0 0
  35.                                                            0 0 1 1 0
  36.                                                            0 0 0 1 0
  37.                                                            0 0 0 0 0
  38.  
  39.  
  40.  
  41.    3)                            Kernel: 1 1       Output: 0 0 0 0 0
  42.                                          1 0               0 1 0 0 0
  43.                                                            0 0 1 0 0
  44.                                                            0 0 0 0 0
  45.                                                            0 0 0 0 0
  46.  
  47.  
  48. 
  49.  
  50. In the first example, the output is only reduced on the right side of the 
  51. input object because the kernel, when aligned with any input pixel, will set 
  52. the output only if both the pixel corresponding to the kernel center is set 
  53. and if the pixel one to the right of that input pixel is set. In a 
  54. similar fashion, the second example reduces the object on the left side. The 
  55. third example uses a kernel of size 2x2, with its center, being the top 
  56. left bit in the kernel. The resulting output object has been reduced to only 
  57. two pixels because only two set pixels in the input object have neighbours 
  58. below and to the right which are both set. All other pixels are cleared. 
  59. The default kernel for berode is a 3 by 3 kernel where every bit is set. 
  60. This will tend to reduce all regions within the input and also eliminate all 
  61. isolated pixels. 
  62.  
  63. The implementation of erosion used in WiT is defined in the paper by 
  64. Haralick, Sternberg and Zhuang, IEEE Transactions on Pattern Analysis and 
  65. Machine Intelligence, July 1987. Border conditions are handled by assuming all 
  66. pixels outside of the input image have non-zero value. Note that when the 
  67. center of the kernel is zero, it is possible for erosion to set an output 
  68. pixel even if the input pixel is zero. 
  69.  
  70. Given a binary image I, the following identities hold for bdilate , berode and 
  71. gerode: 
  72.  
  73.  
  74.  
  75.    berode(I) = inverse(bdilate(inverse(I)))
  76.    bdilate(I) = inverse(berode(inverse(I)))
  77.    gerode(I) = berode(I)
  78.  
  79. 
  80.  
  81. In other words, erosion of the foreground of I is the same as dilating the 
  82. background of I and vice versa. 
  83.  
  84. Given a grayscale image I, the following identity holds for berode and gerode: 
  85.  
  86.  
  87.  
  88.    threshold(gerode(I)) = berode(threshold(I))
  89.  
  90. 
  91.